```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Elasticsearch 集群监控指南 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 700;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            background-color: #2d3748;
            color: #f7fafc;
            border-radius: 0.5rem;
            position: relative;
        }
        .code-copy {
            position: absolute;
            right: 0.5rem;
            top: 0.5rem;
            color: #a0aec0;
            cursor: pointer;
            transition: color 0.2s;
        }
        .code-copy:hover {
            color: #ffffff;
        }
        .tooltip {
            position: relative;
            display: inline-block;
        }
        .tooltip .tooltip-text {
            visibility: hidden;
            width: 120px;
            background-color: #555;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            margin-left: -60px;
            opacity: 0;
            transition: opacity 0.3s;
        }
        .tooltip:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }
        .mermaid {
            background-color: #f8fafc;
            padding: 1.5rem;
            border-radius: 0.5rem;
            margin: 2rem 0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 leading-tight">Elasticsearch 集群监控指南</h1>
                    <p class="text-xl mb-8 opacity-90">掌握核心监控指标与最佳实践，确保集群稳定高效运行</p>
                    <div class="flex space-x-4">
                        <a href="#monitoring-tools" class="bg-white text-indigo-700 hover:bg-gray-100 px-6 py-3 rounded-lg font-medium transition duration-300 shadow-md">
                            <i class="fas fa-tools mr-2"></i>监控工具
                        </a>
                        <a href="#key-metrics" class="bg-indigo-700 hover:bg-indigo-800 text-white px-6 py-3 rounded-lg font-medium transition duration-300 shadow-md">
                            <i class="fas fa-chart-line mr-2"></i>关键指标
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <img src="https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" alt="Elasticsearch 监控" class="rounded-lg shadow-2xl transform rotate-3 border-4 border-white">
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-5xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="bg-white p-8 rounded-xl shadow-md">
                <p class="text-lg text-gray-700 mb-6">
                    监控 Elasticsearch 集群的健康状态和性能是确保系统稳定和高效运行的关键。通过使用 Kibana、Elasticsearch 自带的 API、Elastic Stack、Prometheus 和 Grafana、Elastic APM 等工具，可以实现全面的监控。
                </p>
                <div class="flex flex-wrap -mx-2">
                    <div class="w-full sm:w-1/2 md:w-1/3 px-2 mb-4">
                        <div class="bg-blue-50 p-4 rounded-lg border border-blue-100 flex items-start">
                            <div class="bg-blue-100 p-3 rounded-full mr-4">
                                <i class="fas fa-heartbeat text-blue-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-blue-800 mb-1">集群健康</h3>
                                <p class="text-sm text-gray-600">实时监控集群状态 (绿色/黄色/红色)</p>
                            </div>
                        </div>
                    </div>
                    <div class="w-full sm:w-1/2 md:w-1/3 px-2 mb-4">
                        <div class="bg-purple-50 p-4 rounded-lg border border-purple-100 flex items-start">
                            <div class="bg-purple-100 p-3 rounded-full mr-4">
                                <i class="fas fa-microchip text-purple-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-purple-800 mb-1">节点性能</h3>
                                <p class="text-sm text-gray-600">CPU、内存、磁盘和网络使用情况</p>
                            </div>
                        </div>
                    </div>
                    <div class="w-full sm:w-1/2 md:w-1/3 px-2 mb-4">
                        <div class="bg-green-50 p-4 rounded-lg border border-green-100 flex items-start">
                            <div class="bg-green-100 p-3 rounded-full mr-4">
                                <i class="fas fa-database text-green-600 text-xl"></i>
                            </div>
                            <div>
                                <h3 class="font-bold text-green-800 mb-1">索引性能</h3>
                                <p class="text-sm text-gray-600">查询响应、写入速度和分片状态</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Monitoring Tools -->
        <section id="monitoring-tools" class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2 flex items-center">
                <i class="fas fa-tools mr-3 text-indigo-600"></i>1. 监控工具
            </h2>

            <!-- Kibana -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-yellow-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-chart-pie text-yellow-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">1.1. Kibana</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>功能：</strong>Kibana 是 Elastic Stack 的一部分，用于数据可视化和监控。它提供了仪表盘、图表和其他可视化工具，帮助用户实时监控 Elasticsearch 集群的状态。
                        </p>
                        <p class="text-gray-700 mb-4">
                            <strong>使用：</strong>通过 Kibana 的 <strong>Monitoring</strong> 插件，可以查看集群健康、节点状态、索引状态和查询性能等信息。
                        </p>
                        <div class="flex items-center text-sm text-blue-600">
                            <i class="fas fa-link mr-2"></i>
                            <span>了解更多: https://www.elastic.co/guide/en/kibana/current/monitoring-data.html</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Elasticsearch API -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-code text-blue-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">1.2. Elasticsearch 自带的监控 API</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>功能：</strong>Elasticsearch 提供了一些监控 API，如 <strong>Cluster Health API</strong>、<strong>Nodes Stats API</strong>、<strong>Indices Stats API</strong> 等，用于获取集群和节点的健康状态、性能指标和资源使用情况。
                        </p>
                        
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-caret-right text-blue-500 mr-2"></i>
                                <span class="font-medium">Cluster Health API：获取集群的健康状态（绿色、黄色、红色）</span>
                            </div>
                            <div class="code-block p-4 mt-2">
                                <div class="code-copy tooltip">
                                    <i class="far fa-copy"></i>
                                    <span class="tooltip-text">复制代码</span>
                                </div>
                                <code class="text-sm">GET /_cluster/health</code>
                            </div>
                        </div>
                        
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-caret-right text-blue-500 mr-2"></i>
                                <span class="font-medium">Nodes Stats API：获取节点的性能指标，包括内存、CPU、磁盘和网络使用情况</span>
                            </div>
                            <div class="code-block p-4 mt-2">
                                <div class="code-copy tooltip">
                                    <i class="far fa-copy"></i>
                                    <span class="tooltip-text">复制代码</span>
                                </div>
                                <code class="text-sm">GET /_nodes/stats</code>
                            </div>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-caret-right text-blue-500 mr-2"></i>
                                <span class="font-medium">Indices Stats API：获取索引的性能指标，如文档数、索引大小、查询性能等</span>
                            </div>
                            <div class="code-block p-4 mt-2">
                                <div class="code-copy tooltip">
                                    <i class="far fa-copy"></i>
                                    <span class="tooltip-text">复制代码</span>
                                </div>
                                <code class="text-sm">GET /_stats</code>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- ELK Stack -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-layer-group text-green-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">1.3. Elastic Stack（ELK Stack）</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>功能：</strong>Elastic Stack 包括 Elasticsearch、Logstash 和 Kibana。Logstash 用于日志收集和处理，Kibana 用于数据可视化，Elasticsearch 用于存储和查询数据。结合使用这些工具，可以实现集群健康和性能的全面监控。
                        </p>
                        <p class="text-gray-700 mb-4">
                            <strong>使用：</strong>通过 Logstash 收集集群日志，并将其发送到 Elasticsearch。使用 Kibana 可视化日志和性能数据，创建自定义仪表盘进行实时监控。
                        </p>
                        <!-- ELK Stack Diagram -->
                        <div class="mermaid">
                            graph LR
                            A[Logstash] -->|收集日志| B[Elasticsearch]
                            B -->|存储数据| C[Kibana]
                            C -->|可视化| D[监控仪表盘]
                        </div>
                    </div>
                </div>
            </div>

            <!-- Prometheus + Grafana -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-chart-bar text-purple-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">1.4. Prometheus 和 Grafana</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>功能：</strong>Prometheus 是一个开源的监控和报警系统，Grafana 是一个开源的数据可视化平台。通过 <strong>Prometheus Exporter</strong>（如 elasticsearch_exporter），可以将 Elasticsearch 的性能指标导出到 Prometheus，然后使用 Grafana 进行可视化。
                        </p>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-caret-right text-purple-500 mr-2"></i>
                                <span class="font-medium">Prometheus Exporter：安装并配置 Elasticsearch Exporter，将指标导出到 Prometheus</span>
                            </div>
                            <div class="code-block p-4 mt-2">
                                <div class="code-copy tooltip">
                                    <i class="far fa-copy"></i>
                                    <span class="tooltip-text">复制代码</span>
                                </div>
                                <code class="text-sm"># 下载并运行elasticsearch_exporter
./elasticsearch_exporter --es.uri=http://localhost:9200</code>
                            </div>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-caret-right text-purple-500 mr-2"></i>
                                <span class="font-medium">Grafana：配置 Grafana 与 Prometheus 集成，创建仪表盘以可视化 Elasticsearch 的指标</span>
                            </div>
                            <div class="flex items-center text-sm text-blue-600 mt-2">
                                <i class="fas fa-external-link-alt mr-2"></i>
                                <span>官方仪表盘模板: https://grafana.com/grafana/dashboards/2322</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Elastic APM -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-red-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-tachometer-alt text-red-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">1.5. Elastic APM</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>功能：</strong>Elastic APM（Application Performance Monitoring）是 Elastic Stack 的一部分，提供应用程序性能监控。它可以与 Elasticsearch 集成，监控应用程序的性能和 Elasticsearch 查询的响应时间。
                        </p>
                        <p class="text-gray-700">
                            <strong>使用：</strong>安装并配置 APM Agent，在应用程序中捕获性能数据，并将其发送到 APM Server，最后通过 Kibana 可视化。
                        </p>
                        <!-- APM Architecture Diagram -->
                        <div class="mermaid mt-6">
                            graph TB
                            A[应用程序] -->|APM Agent| B[APM Server]
                            B --> C[Elasticsearch]
                            C --> D[Kibana APM]
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Key Metrics -->
        <section id="key-metrics" class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b pb-2 flex items-center">
                <i class="fas fa-chart-line mr-3 text-indigo-600"></i>2. 常用监控指标
            </h2>

            <!-- Cluster Health -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-heartbeat text-green-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">2.1. 集群健康状态</h3>
                    </div>
                    <div class="pl-16">
                        <p class="text-gray-700 mb-4">
                            <strong>健康状态：</strong>集群的健康状态分为绿色（所有分片都正常）、黄色（主分片正常，副本分片丢失）和红色（主分片丢失）。
                        </p>
                        <p class="text-gray-700 mb-4">
                            <strong>监控点：</strong><code>Cluster Health API</code> 中的 <code>status</code> 字段。
                        </p>
                        <div class="flex -mx-2 mb-4">
                            <div class="w-1/3 px-2">
                                <div class="bg-green-50 p-4 rounded-lg border border-green-200 text-center">
                                    <div class="text-green-600 text-2xl font-bold mb-1">绿色</div>
                                    <div class="text-sm text-gray-600">所有分片正常</div>
                                </div>
                            </div>
                            <div class="w-1/3 px-2">
                                <div class="bg-yellow-50 p-4 rounded-lg border border-yellow-200 text-center">
                                    <div class="text-yellow-600 text-2xl font-bold mb-1">黄色</div>
                                    <div class="text-sm text-gray-600">副本分片丢失</div>
                                </div>
                            </div>
                            <div class="w-1/3 px-2">
                                <div class="bg-red-50 p-4 rounded-lg border border-red-200 text-center">
                                    <div class="text-red-600 text-2xl font-bold mb-1">红色</div>
                                    <div class="text-sm text-gray-600">主分片丢失</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Node Performance -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-server text-blue-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">2.2. 节点性能</h3>
                    </div>
                    <div class="pl-16">
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-memory text-blue-500 mr-2"></i>
                                <span class="font-medium">内存使用：包括 JVM 堆内存使用、非堆内存使用、垃圾回收统计等</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>jvm</code> 和 <code>mem</code> 字段</p>
                        </div>
                        
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-microchip text-blue-500 mr-2"></i>
                                <span class="font-medium">CPU 使用：节点的 CPU 使用情况，影响查询和索引性能</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>cpu</code> 字段</p>
                        </div>
                        
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-hdd text-blue-500 mr-2"></i>
                                <span class="font-medium">磁盘使用：节点的磁盘空间使用情况，确保有足够的磁盘空间</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>fs</code> 字段</p>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-network-wired text-blue-500 mr-2"></i>
                                <span class="font-medium">网络流量：节点的网络流量，包括传入和传出流量</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>transport</code> 和 <code>http</code> 字段</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Index Performance -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-100 p-3 rounded-lg mr-4">
                            <i class="fas fa-database text-purple-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">2.3. 索引性能</h3>
                    </div>
                    <div class="pl-16">
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-search text-purple-500 mr-2"></i>
                                <span class="font-medium">查询性能：查询的响应时间和吞吐量，影响用户体验</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Indices Stats API</code> 中的 <code>search</code> 字段</p>
                        </div>
                        
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-pen-fancy text-purple-500 mr-2"></i>
                                <span class="font-medium">索引性能：索引的写入速度、刷新时间、合并操作等</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Indices Stats API</code> 中的 <code>indexing</code> 字段</p>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-puzzle-piece text-purple-500 mr-2"></i>
                                <span class="font-medium">分片状态：分片的健康状态、大小和分布情况</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Indices Stats API</code> 中的 <code>shards</code> 字段</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- JVM Metrics -->
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8 card-hover">
                <div class="p-6">
                    <div class="flex items-center mb-4">
                        <div class="bg-red-100 p-3 rounded-lg mr-4">
                            <i class="fab fa-java text-red-600 text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold text-gray-800">2.4. JVM 和系统级指标</h3>
                    </div>
                    <div class="pl-16">
                        <div class="mb-6">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-trash-alt text-red-500 mr-2"></i>
                                <span class="font-medium">垃圾回收：GC 次数和时间，影响内存的清理效率</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>jvm.gc</code> 字段</p>
                        </div>
                        
                        <div class="mb-4">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-users text-red-500 mr-2"></i>
                                <span class="font-medium">线程池：线程池的使用情况，包括活跃线程数、队列大小等</span>
                            </div>
                            <p class="text-gray-700 text-sm pl-8">监控点：<code>Nodes Stats API</code> 中的 <code>thread_pool</code> 字段</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary -->
        <section class="bg-indigo-50 rounded-xl p-8 mb-16">
            <div class="flex items-start">
                <div class="bg-indigo-100 p-3 rounded-full mr-4">
                    <i class="fas fa-lightbulb text-indigo-600 text-2xl"></i>
                </div>
                <div>
                    <h3 class="text-xl font-bold text-indigo-800 mb-4">监控最佳实践</h3>
                    <ul class="list-disc pl-6 text-gray-700 space-y-2">
                        <li>建立基线：记录正常状态下的指标值，便于识别异常</li>
                        <li>设置警报：对关键指标（如集群状态、磁盘空间）设置警报阈值</li>
                        <li>定期检查：制定定期检查计划，包括每日、每周和每月检查</li>
                        <li>性能优化：根据监控数据持续优化集群配置和查询</li>
                        <li>文档记录：记录监控配置和异常处理流程</li>
                    </ul>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-white text-xl font-bold mb-2">技术小馆</h3>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fas fa-external-link-alt mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
                <div class="flex space-x-4">
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-github text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-twitter text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-linkedin text-xl"></i>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-6 pt-6 text-center text-sm text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Add copy functionality to code blocks
        document.querySelectorAll('.code-copy').forEach(button => {
            button.addEventListener('click', () => {
                const codeBlock = button.parentElement;
                const code = codeBlock.querySelector('code').innerText;
                navigator.clipboard.writeText(code)
                    .then(() => {
                        const tooltip = button.querySelector('.tooltip-text');
                        tooltip.textContent = '已复制!';
                        setTimeout(() => {
                            tooltip.textContent = '复制代码';
                        }, 2000);
                    });
            });
        });
    </script>
</body>
</html>
```